package com.yyq.adms.util;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import jxl.Cell;
import jxl.Range;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

import org.apache.commons.lang.ObjectUtils;

import com.yyq.adms.sysmanage.pojo.DataDictionary;
import com.yyq.adms.sysmanage.pojo.MethodBean;
import com.yyq.adms.yyb.advance.pojo.STReport;
import com.yyq.adms.yyb.paper.pojo.PublishPaper;
import com.yyq.adms.yyb.summary.pojo.TechnologyReport;
import com.yyq.adms.zz.pojo.Writings;
import com.yyq.servlets.ApplicationContextHandle;
import com.yyq.sos.permission.LoginUser;
import com.yyq.sos.service.BaseBpo;
import com.yyq.sos.util.DepartmentUtil;
import com.yyq.sos.util.ObjectUtil;

public class JxlsUtil {

	private static JxlsUtil jxlsUtil = new JxlsUtil();
	private JxlsUtil(){
	}
	
	public static JxlsUtil getInstance(){ 
		return jxlsUtil;
	}
	
	public synchronized List<Map<String,JxlsVo>>  transfromData(File file){
		List<Map<String,JxlsVo>> list = new ArrayList<Map<String,JxlsVo>>();
		Workbook wb = null;
		try {
			wb = Workbook.getWorkbook(file);
			int sheetCount = wb.getNumberOfSheets();
			if(sheetCount>0){
				Sheet sheet = wb.getSheet(0);
				Cell[] c = sheet.getRow(2);
				if(c != null){
					int row = sheet.getRows();
					Cell header = c[0];
					if(header != null){
						for(int j=header.getRow()+1;j<row;j++){
							Map<String,JxlsVo> map = new HashMap<String,JxlsVo>();
							StringBuffer sb = new StringBuffer();
							for(int i=0;i<c.length;i++){
								if(c[i]!=null){
									String key = ObjectUtils.toString(getCellContent(sheet,c[i])).trim();
									if("".equals(key)){
										continue;
									}
									Cell cc = sheet.getCell(c[i].getColumn(), j);
									String value = ObjectUtils.toString(getCellContent(sheet,cc)).trim();
									sb.append(value);
									JxlsVo jv = new JxlsVo();
									jv.setColumn(cc.getColumn()+1);
									jv.setRow(cc.getRow()+1);
									jv.setContent(value);
									map.put(ObjectUtils.toString(getCellContent(sheet,c[i])), jv);
								}
							}
							if("".equals(sb.toString())){
								continue;
							}
							list.add(map);
						}
					}
				}
			}
		} catch (BiffException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally{
			if(wb != null){
				wb.close();
				wb = null;
			}
		}
		return list;
	}
	
	public synchronized List<Map<String,JxlsVo>>  transfromData(File file,int rowNum){
		List<Map<String,JxlsVo>> list = new ArrayList<Map<String,JxlsVo>>();
		Workbook wb = null;
		try {
			wb = Workbook.getWorkbook(file);
			int sheetCount = wb.getNumberOfSheets();
			if(sheetCount>0){
				Sheet sheet = wb.getSheet(0);
				Cell[] c = sheet.getRow(rowNum);
				if(c != null){
					int row = sheet.getRows();
					Cell header = c[0];
					if(header != null){
						for(int j=header.getRow()+1;j<row;j++){
							StringBuffer sb = new StringBuffer();
							Map<String,JxlsVo> map = new HashMap<String,JxlsVo>();
							for(int i=0;i<c.length;i++){
								if(c[i]!=null){
									String key = ObjectUtils.toString(getCellContent(sheet,c[i])).trim();
									if("".equals(key)){
										continue;
									}
									Cell cc = sheet.getCell(c[i].getColumn(), j);
									String value = ObjectUtils.toString(getCellContent(sheet,cc)).trim();
									sb.append(value);
									JxlsVo jv = new JxlsVo();
									jv.setColumn(cc.getColumn()+1);
									jv.setRow(cc.getRow()+1);
									jv.setContent(value);
									map.put(key, jv);
								}
							}
							if("".equals(sb.toString())){
								continue;
							}
							list.add(map);
						}
					}
				}
			}
		} catch (BiffException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		} finally{
			if(wb != null){
				wb.close();
				wb = null;
			}
		}
		return list;
	}
	
	private  String getCellContent(Sheet sheet, Cell cell)
	{
		String content = cell.getContents();
		if(content==null||"".equals(content))
		{
			content = getContentFromMargeCell(sheet,cell);
		}
		return content;
	}
	
	private String getContentFromMargeCell(Sheet sheet, Cell cell)
	{
		String content= null;
		Range[] ranges = sheet.getMergedCells();
		for(int i=0;i<ranges.length;i++)
		{
			Cell topLeft = ranges[i].getTopLeft();
			Cell bottomRight = ranges[i].getBottomRight();
			int topLeft_col = topLeft.getColumn();
			int topLeft_row = topLeft.getRow();
			int bottomRight_col = bottomRight.getColumn();
			int bottomRight_row = bottomRight.getRow();
			int col = cell.getColumn();
			int row = cell.getRow();
			if(col>=topLeft_col&&row>=topLeft_row&&col<=bottomRight_col&&row<=bottomRight_row)
			{
				content = topLeft.getContents();
				break;
			}
		}
		return content;
	}
	
	public synchronized StringBuffer[] validateXls(List<Map<String,JxlsVo>> data,
			Map<String,ValidateVo> vMap,Class cls,List list, LoginUser user, 
			List<Map<String, JxlsVo>> otherOrgRepeatData) throws Exception{
		StringBuffer errMsg = new StringBuffer();
		Map<String, MethodBean> mbm = ValidateUtil.getMethodMap(vMap, cls);
		Method sentDepM = ObjectUtil.getMethod(cls, "setSentDep", new Class[]{String.class});
		Method sentDepNameM = ObjectUtil.getMethod(cls, "setSentDepName", new Class[]{String.class});
		List<ValidateVo> combineUniqueneValidateVo = new ArrayList<ValidateVo>(); 
		boolean isFirst = true;
		StringBuffer[] msgs = new StringBuffer[2];
		StringBuffer repeatDBMsg = new StringBuffer();
		StringBuffer repeatKey = new StringBuffer();
		for (Map<String,JxlsVo> dataMap : data) {
			Object obj = null;
			int row = 0;
			if(errMsg.toString().equals(""))
				obj = cls.newInstance();
			boolean isRepeatDB = false;
			JxlsVo indexMsg=null;
			for(String key:dataMap.keySet()){
				if("".equals(key))
					continue;
				JxlsVo vo = dataMap.get(key);
				if(row==0){
					row = vo.getRow();
				}
				ValidateVo vvo = vMap.get(key);
				if(vvo.isUniquene()){
					if(!vvo.isNull() && !vo.getContent().equals("")){
						if("".equals(repeatKey.toString())){
							repeatKey.append(key);
						}
						isRepeatDB = checkDBData(vvo, vo.getContent(), cls, user);
						
						if(isRepeatDB){
							indexMsg = new JxlsVo();
							indexMsg.setContent("第"+row+"行("+key+")数据与数据库重复了");
							indexMsg.setRow(row);
							/*MethodBean excelIndexMsgBean = mbm.get("excelIndexMsg");
							Method sm = excelIndexMsgBean.getSMethod();
							if(sm != null){
								sm.invoke(obj, "第"+row+"行与数据库数据重复");
							}
							//preErrMsg(repeatDBMsg,vo,key);
							//repeatDBMsg.append("(").append(vo.getContent()).append(")")
							//repeatDBMsg.append("与数据库里数据重复了!<br/>");*/
						}
					}
				}
				MethodBean mb = mbm.get(vvo.getName());
				String content = vo.getContent();
				if(isFirst){
					if(vvo.isCombineUniquene()){
						if("".equals(repeatKey.toString())){
							repeatKey.append(key);
						}else{
							repeatKey.append("+").append(key);
						}
						combineUniqueneValidateVo.add(vvo);
					}
				}
				if(vvo.getName().trim().equals("belongPlateFormID")){
					String[] plateForm = content.split("[,，]");
					//String palateFormStr = "";
					boolean flag = true;
					for(int i=0;plateForm != null && i<plateForm.length;i++){
						vo.setContent(plateForm[i]);
						boolean temp = processDataDictionary(errMsg,obj,key,vo,vvo,mb,false);
						if(!temp){
							flag = temp;
						}
					}
					if(flag){
						vo.setContent(content);
						setObjectValue(obj,vo,vvo,mb,errMsg,key);
					}
				}else if(vvo.isSentDep()){
					if(!"".equals(content)){
						String[] sentDeps = content.split("[,，]");
						String sentDepStr = "";
						String sentDepName = "";
						for(int i=0;i<sentDeps.length;i++){
							Long sentDeptId = DepartmentUtil.getInstance().getValue(sentDeps[i]);
							if(sentDeptId != null){
								if(i==sentDeps.length){
									sentDepStr += sentDeptId;
									sentDepName += sentDeps[i];
								}else{
									sentDepStr += sentDeptId+",";
									sentDepName += sentDeps[i]+(i<(sentDeps.length-1)?",":"");
								}
							}else{
								preErrMsg(errMsg,vo ,key);
								errMsg.append("的").append(sentDeps[i]).append("不正确").append("<br/>");
							}
						}
						if(!sentDepStr.equals("") && obj != null){
							sentDepM.invoke(obj, new Object[]{sentDepStr});
							sentDepNameM.invoke(obj, new Object[]{sentDepName});
							//ObjectUtil.setValue(obj, "setSentDep", new Class[]{String.class}, new Object[]{sentDepStr});
						}
						setObjectValue(obj,vo,vvo,mb,errMsg,key);
					}else if(!vvo.isNull()){
						preErrMsg(errMsg,vo,key);
						errMsg.append("不能为空<br/>");
					}
				}else if(vvo.getDd() != null){
					if(!vo.getContent().equals("")){
						processDataDictionary(errMsg, obj, key, vo, vvo, mb,true);
					}
				}else{
					if(vvo.getMaxlen()>0 && vo.getContent().length()>vvo.getMaxlen()){
						preErrMsg(errMsg,vo,key);
						errMsg.append(vo.getContent()).append(",").append("其数据长度大于最大度度(值长度为")
						.append(vo.getContent().length()).append(")最大长度为("+vvo.getMaxlen())
						.append(")").append("<br/>");
					}
					if(!ObjectUtils.toString(vvo.getDateFormat()).equals("")){
						if(!vvo.isNull() || !vo.getContent().equals("")){
							SimpleDateFormat sdf = new SimpleDateFormat(ObjectUtils.toString(vvo.getDateFormat()));
							Date d = null;
							try {
								sdf.parse(vo.getContent());
							} catch (ParseException e) {
								preErrMsg(errMsg,vo,key);
								errMsg.append(vo.getContent()).append(":").append("其日期格式不正确(").append(vvo.getDateFormat())
								.append(")<br/>");
							}
							/*if(d != null){
								String temp = sdf.format(d);
								if(!temp.equals(vo.getContent())){
									preErrMsg(errMsg,vo,key);
									errMsg.append(vo.getContent()).append(":").append("其日期格式不正确(").append(vvo.getDateFormat())
									.append(")<br/>");
								}
							}*/
						}
					}
					if(!vvo.isNull()){
						if(ObjectUtils.toString(vo.getContent()).equals("")){
							preErrMsg(errMsg,vo,key);
							errMsg.append("不能为空<br/>");
						}
					}
					
					if(obj != null){
						setObjectValue(obj,vo,vvo,mb,errMsg,key);
					}
				}
			}
			
			if(indexMsg != null){
				dataMap.put("excelIndexMsg", indexMsg);
			}
			isFirst = false;
			if(!isRepeatDB && combineUniqueneValidateVo.size()>0){
				isRepeatDB = checkReapeatDB(cls,dataMap,combineUniqueneValidateVo,user);
				/*if(isRepeatDB){
					MethodBean excelIndexMsgBean = mbm.get("excelIndexMsg");
					Method sm = excelIndexMsgBean.getSMethod();
					if(sm != null){
						sm.invoke(obj, "第"+row+"行与数据库数据重复");
					}
				}*/
			}
			if(errMsg.toString().equals("")){
				if(cls==Writings.class || cls == STReport.class 
				|| cls==TechnologyReport.class || cls == PublishPaper.class){
					sentDepNameM.invoke(obj, new Object[]{user.getOrgname()});
				}
			}
			if(!isRepeatDB){
				list.add(obj);
			}else{
				otherOrgRepeatData.add(dataMap);
			}
		}
		//otherOrgRepeatData.add(repeatDBMsg);
		//if(errMsg.toString().equals("")){
			if( combineUniqueneValidateVo.size() > 0){
				checkRepeatCombineUniquene(data,otherOrgRepeatData,combineUniqueneValidateVo);
			}
			for(String key:vMap.keySet()){
				ValidateVo vvo = vMap.get(key);
				if(vvo.isUniquene()){
					checkRepeat(key,data,otherOrgRepeatData);
				}
			}
		//}
		msgs[0]=errMsg;
		msgs[1] = repeatKey;
		return msgs;
	}

	private boolean processDataDictionary(StringBuffer errMsg, Object obj,
			String key, JxlsVo vo, ValidateVo vvo, MethodBean mb,boolean isSetValue) {
		boolean ddflag = false;
		for(int i=0;i<vvo.getDd().size();i++){
			DataDictionary dd = vvo.getDd().get(i);
			if(dd.getText().equals(vo.getContent())){
				if(isSetValue){
					vo.setContent(dd.getValue());
					setObjectValue(obj,vo,vvo,mb,errMsg,key);
					vo.setContent(dd.getText());
				}
				ddflag = true;
				break;
			}
		}
		if(!ddflag){
			preErrMsg(errMsg,vo ,key);
			errMsg.append("不正确").append("<br/>");
		}
		
		return ddflag;
	}
	
	private void checkRepeatCombineUniquene(List<Map<String, JxlsVo>> data, List<Map<String,JxlsVo>> otherOrgRepeatData,
			List<ValidateVo> combineUniqueneValidateVo) {
		Map<String,Integer> check = new HashMap<String,Integer>();
		String key = "";
		SimpleDateFormat sdf = null;
		SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy");
		for(int i=0;i<data.size();i++){
			Map<String, JxlsVo> map = data.get(i);
			String content = "";
			int row = 0;
			for(ValidateVo vvo:combineUniqueneValidateVo){
				if(i==0){
					if(key.equals("")){
						key = vvo.getCname();
					}else{
						key += "+"+vvo.getCname();
					}
					if("DATE".equals(vvo.getType())){
						key += "年度";
					}
				}
				JxlsVo vo = map.get(vvo.getCname());
				if(row == 0){
					row = vo.getRow();
				}
				if(vvo.getDateFormat() != null && !vvo.getDateFormat().equals("")
						&& !vvo.getDateFormat().equals("yyyy")){
					if(sdf == null){
						sdf = new SimpleDateFormat(vvo.getDateFormat());
					}
					try {
						Date dTemp = sdf.parse(vo.getContent());
						String con = sdf1.format(dTemp);
						content += con;
					} catch (ParseException e) {
						e.printStackTrace();
					}
				}else{
					content += vo.getContent();
				}
			}
			if(check.containsKey(content)){
				JxlsVo indexMsgPre = new JxlsVo();
				indexMsgPre.setContent("第"+check.get(content)+"行"+key+"与"+row+"行数据重复了");
				indexMsgPre.setRow(check.get(content));
				int index = row-check.get(content);
				Map<String,JxlsVo> mapPre = data.get(i-index);
				mapPre.put("excelIndexMsg", indexMsgPre);
				JxlsVo indexMsg = new JxlsVo();
				indexMsg.setContent("第"+row+"行"+key+"与"+check.get(content)+"行数据重复了");
				indexMsg.setRow(row);
				map.put("excelIndexMsg", indexMsg);
				otherOrgRepeatData.add(mapPre);
				otherOrgRepeatData.add(map);
			}else{
				check.put(content, Integer.valueOf(row));
			}
		}
		
	}

	private boolean checkReapeatDB(Class cls, Map<String, JxlsVo> dataMap,
			List<ValidateVo> combineUniqueneVvo,LoginUser user) {
		String condition = "";
		SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
		String key = "(";
		String value = "(";
		int row = 0;
		for(int i=0;i<combineUniqueneVvo.size();i++){
			ValidateVo vvo = combineUniqueneVvo.get(i);
			JxlsVo vo = dataMap.get(vvo.getCname());
			if(row==0){
				row = vo.getRow();
			}
			if(key.equals("(")){
				key = vvo.getCname();
				value = vo.getContent();
			}else{
				key += "+"+vvo.getCname();
				value += "+"+vo.getContent();
			}
			
			condition += " and "+vvo.getName();
			
			String v = vo.getContent();
			if(vvo.getDd() != null && vvo.getDd().size()>0){
				for(int j=0;j<vvo.getDd().size();j++){
					DataDictionary dd = vvo.getDd().get(j);
					if(dd.getText().equals(vo.getContent())){
						v = dd.getValue();
						break;
					}
				}
			}
			
			if(vvo.getDateFormat() != null && !vvo.getDateFormat().equals("")
					&& !vvo.getDateFormat().equals("yyyy")){
				SimpleDateFormat sdf = new SimpleDateFormat(vvo.getDateFormat());
				try {
					Date tempd = sdf.parse(v);
					String dvalue = yearFormat.format(tempd);
					condition += " like '%"+dvalue+"%' ";
				} catch (ParseException e) {
					e.printStackTrace();
				}
			}else{
				if(vvo.getType().equals("INT")||vvo.getType().equals("LONG")
						|| vvo.getType().equals("FLT")){
					condition += "="+v;
				}else{
					condition += "='"+v+"'";
				}
			}
		}
		key +=")";
		value += ")";
		BaseBpo bpo = (BaseBpo)ApplicationContextHandle.getBean("sysParametersBpo");
		String hql = "from "+cls.getName()+" obj where  " +
				"(obj.maintainDep="+user.getOrgId()+" or " +
				"EXISTS(from RecordSentDep rsd where obj.id=rsd.sourceRecordId " +
				"and rsd.yyqTableName='"+bpo.getTableName(cls)+"' and rsd.sentDepId="+user.getOrgId()+"))" +
				" "+condition;
		Long count = bpo.count(hql);
		if(count >0){
			JxlsVo indexMsg = new JxlsVo();
			indexMsg.setContent("第"+row+"行("+key+")数据与数据库重复了");
			indexMsg.setRow(row);
			dataMap.put("excelIndexMsg", indexMsg);
			//otherOrgRepeatData.append("第").append(row).append("行").append(key)
			//.append("的").append(value)
			//.append("与数据库里数据重复了!<br/>");
			return true;
		}else {
			return false;
		}
	}

	private void setObjectValue(Object obj,JxlsVo vo,ValidateVo vvo,MethodBean mb,StringBuffer errMsg,String key) {
		Class cls = null;
		Object value = null;
		if(vvo.getType().equals("INT")){
			try {
				if(vo.getContent().equals("") && vvo.isNull()){
					value = null;
				}else{
					value = Integer.valueOf(vo.getContent());
				}
			} catch (NumberFormatException e) {
				preErrMsg(errMsg,vo ,key);
				errMsg.append("不是整数").append("<br/>");
				e.printStackTrace();
			}
		}else if(vvo.getType().equals("STR")){
			if(vvo.isMerge()){
				Object temp = null;
				try {
					if(obj != null)
					temp = mb.getGMethod().invoke(obj, null);
				} catch (Exception e) {} 
				String pre = ObjectUtils.toString(temp);
				if(!vo.getContent().equals("")){
					if(!"".equals(pre)){
						value = pre+","+ObjectUtils.toString(vo.getContent());
					}else{
						value = ObjectUtils.toString(vo.getContent());
					}
				}else{
					value = null;
				}
			}else{
				value = ObjectUtils.toString(vo.getContent());
				if(value.equals("")){
					value=null;
				}
			}
		}else if(vvo.getType().equals("DATE")){
			SimpleDateFormat sdf = null;
			if(ObjectUtils.toString(vvo.getDateFormat()).equals("")){
				sdf = new SimpleDateFormat("yyyy-MM-dd");
			}else{
				sdf = new SimpleDateFormat(vvo.getDateFormat());
			}
			try {
				if(vo.getContent().equals("") && vvo.isNull()){
					value = null;
				}else{
					value = sdf.parse(ObjectUtils.toString(vo.getContent()));
				}
			} catch (ParseException e) {
				preErrMsg(errMsg,vo ,key);
				errMsg.append("日期格式不正确").append("<br/>");
				e.printStackTrace();
			}
		}else if(vvo.getType().equals("LONG")){
			try {
				if(vo.getContent().equals("") && vvo.isNull()){
					value = null;
				}else{
					value = Long.valueOf(vo.getContent());
				}
			} catch (NumberFormatException e) {
				preErrMsg(errMsg,vo ,key);
				errMsg.append("不是长整数").append("<br/>");
				e.printStackTrace();
			}
		}else if(vvo.getType().equals("FLT")){
			try {
				if(vo.getContent().equals("") && vvo.isNull()){
					value = null;
				}else{
					value = Long.valueOf(vo.getContent());
				}
			} catch (NumberFormatException e) {
				preErrMsg(errMsg,vo ,key);
				errMsg.append("不是浮点数").append("<br/>");
				e.printStackTrace();
			}
		}
		try {
			if(value != null && obj != null)
				mb.getSMethod().invoke(obj,  new Object[]{value});
		} catch (Exception e) {
		} 
	}

	private boolean checkRepeat(String key,List<Map<String, JxlsVo>> data,List<Map<String, JxlsVo>> otherOrgRepeatData) {
		Map<String,JxlsVo> check = new HashMap<String,JxlsVo>();
		boolean flag = false;
		for(int i=0;i<data.size();i++){
			Map<String, JxlsVo> map = data.get(i);
			JxlsVo vo = map.get(key);
			if(vo.getContent().equals("")){
				continue;
			}
			if(check.containsKey(vo.getContent())){
				JxlsVo temp = check.get(vo.getContent());
				/*errMsg.append("第").append(vo.getRow()).append("行")
				.append(key).append("与")
				.append("第").append(temp.getRow()).append("行");
				errMsg.append("出现重复了").append("<br/>");*/
				int index = vo.getRow()-temp.getRow();
				Map<String,JxlsVo> tempMap = data.get(i-index);
				JxlsVo indexMsgPre = new JxlsVo();
				indexMsgPre.setContent("第"+temp.getRow()+"行"+key+"与第"+vo.getRow()+"行数据重复了");
				indexMsgPre.setRow(temp.getRow());
				tempMap.put("excelIndexMsg", indexMsgPre);
				JxlsVo indexMsg = new JxlsVo();
				indexMsg.setContent("第"+vo.getRow()+"行"+key+"与第"+temp.getRow()+"行数据重复了");
				indexMsg.setRow(vo.getRow());
				map.put("excelIndexMsg", indexMsg);
				otherOrgRepeatData.add(tempMap);
				otherOrgRepeatData.add(map);
				flag = true;
			}else{
				check.put(vo.getContent(),vo);
			}
		}
		return flag;
	}

	private boolean checkDBData(ValidateVo vvo, String content, Class cls,
			LoginUser user) {
		boolean flag = false;
		String condition=" and "+vvo.getName();
		if("INT".equals(vvo.getType()) || "FLT".equals(vvo.getType()) || "LONG".equals(vvo.getType())){
			condition += "="+content;
		}else{
			condition += "='"+content+"'";
		}
		BaseBpo bpo = (BaseBpo)ApplicationContextHandle.getBean("sysParametersBpo");
		String hql = "from "+cls.getName()+" obj where  " +
			"(obj.maintainDep="+user.getOrgId()+" or " +
			"EXISTS(from RecordSentDep rsd where obj.id=rsd.sourceRecordId " +
			"and rsd.yyqTableName='"+bpo.getTableName(cls)+"' and rsd.sentDepId="+user.getOrgId()+"))" +
			" "+condition;
		Long count = bpo.count(hql);
		flag = count > 0 ? true : false;
		return flag;
	}

	public static void preErrMsg(StringBuffer errMsg,JxlsVo vo ,String key){
		errMsg.append("第").append(vo.getRow()).append("行,第")
		.append(vo.getColumn()).append("列 ").append(key).append("的值");
	}
	
	public static void main(String[] args) {
		//List<Map<String,JxlsVo>> list = JxlsUtil.getInstance().transfromData(new File("D:/yyq/template/获批工法模板.xls"));
		List<Map<String,JxlsVo>> list = JxlsUtil.getInstance().transfromData(new File("D:/yyq/template/科技进步奖奖励申报模板.xls"));
		//List<Map<String,JxlsVo>> list = JxlsUtil.getInstance().transfromData(new File("D:/yyq/template/获批工法.xls"));
		for (Map<String, JxlsVo> map : list) {
			Set<String> set = map.keySet();
			for (String content : set) {
				JxlsVo vo = map.get(content);
				System.out.print(content+" 值:"+vo.getContent()+" 在第"+vo.getRow()+"行 第"+vo.getColumn()+"列\t");
			}
			System.out.println();
		}
		
	}
}
